package com.esun.util;

import java.util.UUID;

import com.esun.cheetah.config.Config;

import android.content.Context;
import android.content.SharedPreferences;

public class PushUtils {
	private static SharedPreferences sharedPrefValues;
	public static String newRandomUUID() {
		String uuidRaw = UUID.randomUUID().toString();
		return uuidRaw.replaceAll("-", "");
	}
	public static void isNewUUId(Context context){
		sharedPrefValues = context.getSharedPreferences(Config.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
		if (sharedPrefValues.getString(Config.IMEI, "").equals("")) {
			sharedPrefValues.edit().putString(Config.IMEI, newRandomUUID()).commit();
		}
	}
	/**
	 * 获取push 唯一码
	 * @return
	 */
	public static String getPushUnique(){
		return sharedPrefValues.getString(Config.IMEI, "");
	}
}
